VERSION 5.00 Begin VB.Form frmVbcM BorderStyle = 1 'Fixed Single Caption = "Visual Basic Project Copy" ClientHeight = 5376 ClientLeft = 36 ClientTop = 324 ClientWidth = 7080 Icon = "frmVbcM.frx":0000 LinkTopic = "frmVbcM" MaxButton = 0 'False ScaleHeight = 5376 ScaleWidth = 7080 StartUpPosition = 3 'Windows Default WhatsThisHelp = -1 'True Begin VB.Frame fraOptions Caption = "Options" Height = 732 Left = 120 TabIndex = 23 ToolTipText = "Select the Copy Options here" Top = 4560 Width = 5412 Begin VB.CheckBox chkNoHelp Caption = "Don't Copy .hlp File" Height = 252 Left = 2640 TabIndex = 32 ToolTipText = "Check if you don't want to Copy the .hlp file" Top = 360 Width = 2532 End Begin VB.CheckBox chkNoExe Caption = "Don't Copy .exe File" Height = 252 Left = 120 TabIndex = 31 ToolTipText = "Check if you don't want to Copy the .exe file" Top = 360 Width = 2412 End End Begin VB.CommandButton cmdOpenOutput Caption = "Open Output Project" Height = 492 Left = 5760 TabIndex = 30 ToolTipText = "Opens the VB Project stored in the Output Directory" Top = 3360 Width = 1212 End Begin VB.CommandButton cmdOpenInput Caption = "Open Input Project" Height = 492 Left = 5760 TabIndex = 29 ToolTipText = "Opens the Input VB Project" Top = 2760 Width = 1212 End Begin VB.CommandButton cmdCancel Caption = "Exit" BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 612 Left = 5760 TabIndex = 24 ToolTipText = "Exists from Visual Basic Project Copy" Top = 240 Width = 1212 End Begin VB.Frame fraReplace Caption = "String Replacement" Height = 1812 Left = 120 TabIndex = 6 ToolTipText = "Enter the Find and Replace strings here" Top = 2640 Width = 5412 Begin VB.CheckBox chkCase Caption = "Match Case" Height = 252 Index = 4 Left = 4080 TabIndex = 22 ToolTipText = "Set whether to Match Case in Replacement" Top = 1440 Width = 1212 End Begin VB.CheckBox chkCase Caption = "Match Case" Height = 252 Index = 3 Left = 4080 TabIndex = 18 ToolTipText = "Set whether to Match Case in Replacement" Top = 1080 Width = 1212 End Begin VB.CheckBox chkCase Caption = "Match Case" Height = 252 Index = 2 Left = 4080 TabIndex = 14 ToolTipText = "Set whether to Match Case in Replacement" Top = 720 Width = 1212 End Begin VB.CheckBox chkCase Caption = "Match Case" Height = 252 Index = 1 Left = 4080 TabIndex = 10 ToolTipText = "Set whether to Match Case in Replacement" Top = 360 Width = 1212 End Begin VB.TextBox txtFind Height = 288 Index = 4 Left = 120 TabIndex = 19 Text = "Text1" Top = 1440 Width = 1692 End Begin VB.TextBox txtReplace Height = 288 Index = 4 Left = 2280 TabIndex = 21 Text = "Text1" ToolTipText = "Enter a Replacement String" Top = 1440 Width = 1692 End Begin VB.TextBox txtFind Height = 288 Index = 3 Left = 120 TabIndex = 15 Text = "Text1" Top = 1080 Width = 1692 End Begin VB.TextBox txtReplace Height = 288 Index = 3 Left = 2280 TabIndex = 17 Text = "Text1" ToolTipText = "Enter a Replacement String" Top = 1080 Width = 1692 End Begin VB.TextBox txtReplace Height = 288 Index = 2 Left = 2280 TabIndex = 13 Text = "Text1" ToolTipText = "Enter a Replacement String" Top = 720 Width = 1692 End Begin VB.TextBox txtReplace Height = 288 Index = 1 Left = 2280 TabIndex = 9 Text = "Text1" ToolTipText = "Enter a Replacement String" Top = 360 Width = 1692 End Begin VB.TextBox txtFind Height = 288 Index = 2 Left = 120 TabIndex = 11 Text = "Text1" ToolTipText = "Enter a String to Replace" Top = 720 Width = 1692 End Begin VB.TextBox txtFind Height = 288 Index = 1 Left = 120 TabIndex = 7 Text = "Text1" ToolTipText = "Enter a String to Replace" Top = 360 Width = 1692 End Begin VB.Label lblWith AutoSize = -1 'True Caption = "with" Height = 192 Index = 4 Left = 1920 TabIndex = 20 Top = 1440 Width = 264 End Begin VB.Label lblWith AutoSize = -1 'True Caption = "with" Height = 192 Index = 3 Left = 1920 TabIndex = 16 Top = 1080 Width = 264 End Begin VB.Label lblWith AutoSize = -1 'True Caption = "with" Height = 192 Index = 2 Left = 1920 TabIndex = 12 Top = 720 Width = 264 End Begin VB.Label lblWith AutoSize = -1 'True Caption = "with" Height = 192 Index = 1 Left = 1920 TabIndex = 8 Top = 360 Width = 264 End End Begin VB.Frame fraStatus Caption = "Frame1" Height = 732 Left = 120 TabIndex = 27 Top = 120 Width = 5412 Begin VB.TextBox txtStatus BackColor = &H8000000F& Height = 288 Left = 120 TabIndex = 28 Text = "Text1" Top = 360 Width = 5172 End End Begin VB.CommandButton cmdClear Caption = "Clear Output Directory" Height = 612 Left = 5760 TabIndex = 26 ToolTipText = "Clears all files from the Output Directory" Top = 1920 Width = 1212 End Begin VB.Frame fraOutput Caption = "Output Directory" Height = 732 Left = 120 TabIndex = 3 ToolTipText = "The Output Directory is where the new VB Project will be created" Top = 1800 Width = 5412 Begin VB.TextBox txtOutput Height = 288 Left = 120 TabIndex = 4 Text = "Text1" ToolTipText = "This is the current Output Directory" Top = 360 Width = 4812 End Begin VB.CommandButton cmdOutput Caption = "..." BeginProperty Font Name = "MS Sans Serif" Size = 9.6 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 252 Left = 4920 TabIndex = 5 ToolTipText = "Chooses the Output Directory for the new VB Project" Top = 360 Width = 372 End End Begin VB.CommandButton cmdRun Caption = "Copy" BeginProperty Font Name = "MS Sans Serif" Size = 13.8 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 612 Left = 5760 TabIndex = 25 ToolTipText = "Copies the VB Project to the Output Directory" Top = 1080 Width = 1212 End Begin VB.Frame fraInput Caption = "Input Visual Basic Project" Height = 732 Left = 120 TabIndex = 0 ToolTipText = "The Input VB Project is the Project that will be copied" Top = 960 Width = 5412 Begin VB.CommandButton cmdInput Caption = "..." BeginProperty Font Name = "MS Sans Serif" Size = 9.6 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 252 Left = 4920 TabIndex = 2 ToolTipText = "Chooses the Input VB Project" Top = 360 Width = 372 End Begin VB.TextBox txtInput Height = 288 Left = 120 TabIndex = 1 Text = "Text1" ToolTipText = "This is the current VB Project that will be copied" Top = 360 Width = 4812 End End Attribute VB_Name = "frmVbcM" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim VBCProgramName As String Private Type VFile VFileName As String VFilePath As String VFileType As String VFileLength As Long VFileContents As String VFileCopy As Integer VFilePresent As Integer End Type Dim NumberVBFiles As Integer Dim VBFiles(1 To 1000) As VFile Dim RunFlag As Integer Dim NL As String Dim NL2 As String Dim InterruptFlag As Integer Private Sub cmdCancel_Click() If (RunFlag = True) Then InterruptFlag = True Exit Sub Else Unload Me End If End Sub Private Sub ClearOutput() Dim wrkInput As String Dim wrkOutput As String Dim wrkPath As String Dim wrkFile As String On Error Resume Next wrkInput = Trim$(txtInput.Text) wrkOutput = Trim$(txtOutput.Text) If (wrkOutput = "") Then MessageError "Must specify the Output Directory." txtOutput.SetFocus Exit Sub End If If (StrComp(wrkInput, wrkOutput, 1) = 0) Then MessageError "Input and Output Directories are the same." txtOutput.SetFocus Exit Sub End If If (JMTestDirectory(wrkOutput) = False) Then MessageError "Output Directory [" & wrkOutput & "] does not exist." txtOutput.SetFocus Exit Sub End If wrkPath = JMAddMissingBackslash(wrkOutput) & "*.*" wrkFile = Dir$(wrkPath) If (wrkFile = "") Then MessageError "Output Directory [" & wrkOutput & "] does not contain any files." txtOutput.SetFocus Exit Sub End If Select Case MsgBox("Are you sure you want to clear Output Directory [" & wrkOutput & "] ?", vbDefaultButton2 + vbYesNo + vbQuestion, "VB Project Copy") Case vbYes Case Else txtOutput.SetFocus Exit Sub End Select Kill wrkPath wrkFile = Dir$(wrkPath) If (wrkFile <> "") Then MessageError "Output Directory [" & wrkOutput & "] still conmtains files. Some may be read only. Check with Explorer!" txtOutput.SetFocus Exit Sub End If End Sub Private Sub cmdClear_Click() On Error Resume Next If (RunFlag = True) Then Exit Sub InterruptFlag = False RunFlag = True MousePointer = 11 cmdRun.Enabled = False cmdCancel.Enabled = False DisableForm ClearOutput EnableForm End Sub Private Sub cmdInput_Click() Dim wrkDirectory As String On Error Resume Next jmSetCommonDialogPosition 1, cmdInput MyCDForm!CommonDialog1.CancelError = True On Error GoTo cmdInputError MyCDForm!CommonDialog1.Filter = "Project Files (*.vbp,*.mak,*.vbg)|*.vbp; *.mak; *.vbg|All Files (*.*)|*.*" MyCDForm!CommonDialog1.FilterIndex = 1 MyCDForm!CommonDialog1.Flags = &H4& Or &H1000& MyCDForm!CommonDialog1.DefaultExt = "vbp" MyCDForm!CommonDialog1.ShowOpen txtInput.Text = MyCDForm!CommonDialog1.FileName Unload MyCDForm cmdInputError: Unload MyCDForm End Sub Private Sub cmdOpenInput_Click() Dim wrkProgramName As String Dim wrkProgramCall As String Dim wrkString As String Dim wrkFlag As Long Dim wrkInput As String On Error Resume Next If (RunFlag = True) Then Exit Sub JMLoadProgram "vbp", wrkProgramName, wrkProgramCall If (wrkProgramCall = "") Then MessageError "Can't find Visual Basic" txtInput.SetFocus Exit Sub End If wrkInput = Trim$(txtInput.Text) If (wrkInput = "") Then MessageError "Must specify the Input VB Project." txtInput.SetFocus Exit Sub End If If (JMFileExists(wrkInput) = False) Then MessageError "Input VB Project [" & wrkInput & "] does not exist." txtInput.SetFocus Exit Sub End If wrkString = JMSetupProgramCall(wrkProgramCall, wrkInput) wrkFlag = Shell(wrkString, vbNormalNoFocus) End Sub Private Sub cmdOpenOutput_Click() Dim wrkProgramName As String Dim wrkProgramCall As String Dim wrkString As String Dim wrkFlag As Long Dim wrkInput As String Dim wrkOutput As String Dim wrkPath As String Dim wrkFile As String On Error Resume Next If (RunFlag = True) Then Exit Sub JMLoadProgram "vbp", wrkProgramName, wrkProgramCall If (wrkProgramCall = "") Then MessageError "Can't find Visual Basic" txtOutput.SetFocus Exit Sub End If wrkOutput = Trim$(txtOutput.Text) If (wrkOutput = "") Then MessageError "Must specify the Output Directory." txtOutput.SetFocus Exit Sub End If wrkInput = Trim$(txtInput.Text) If (wrkInput = "") Then MessageError "Must specify the Input VB Project." txtInput.SetFocus Exit Sub End If If (JMFileExists(wrkInput) = False) Then MessageError "Input VB Project [" & wrkInput & "] does not exist." txtInput.SetFocus Exit Sub End If wrkPath = JMAddMissingBackslash(wrkOutput) & JMExtractFileName(wrkInput) If (JMFileExists(wrkPath) = False) Then MessageError "Output VB Project [" & wrkPath & "] does not exist." txtInput.SetFocus Exit Sub End If wrkString = JMSetupProgramCall(wrkProgramCall, wrkPath) wrkFlag = Shell(wrkString, vbNormalNoFocus) End Sub Private Sub cmdOutput_Click() Dim wrkDirectory As String On Error Resume Next If (BrowseForDirectory(Me, 0, wrkDirectory, "Select the Output Directory") = True) Then txtOutput.Text = wrkDirectory End If End Sub Private Sub cmdRun_Click() On Error Resume Next If (RunFlag = True) Then Exit Sub InterruptFlag = False RunFlag = True MousePointer = 11 cmdCancel.MousePointer = 1 cmdClear.Enabled = False cmdCancel.Caption = "Stop" DisableForm CopyVBProject EnableForm End Sub Private Sub CopyVBProject() Dim wrkInput As String Dim wrkOutput As String Dim wrkPath As String Dim wrkFile As String Dim wrkShortFile As String Dim kk As Integer Dim kkk As Integer Dim wrkStringLength As Long Dim wrkString As String Dim wrkString2 As String Dim wrkFlag As Integer Dim wrkExtension As String Dim wrkFileName As String Dim wrkPos As Integer Dim wrkPos2 As Integer Dim wrkLastCharacter As String Dim wrkCharacter As String Dim wrkCase As Integer Dim wrkOutputProject As String Dim wrkInputData As String Dim wrkInputDirectory As String Dim wrkFindFlag As Integer Dim wrkCopyFlag As Integer Dim wrkPathX As String Dim wrkInputPathX As String Dim wrkError As String Dim wrkRemoveable As Integer Dim wrkTotalSize As Long On Error Resume Next wrkInput = Trim$(txtInput.Text) wrkOutput = Trim$(txtOutput.Text) If (wrkInput = "") Then MessageError "Must specify the Input VB Project." txtInput.SetFocus Exit Sub End If If (JMFileExists(wrkInput) = False) Then MessageError "Input VB Project [" & wrkInput & "] does not exist." txtInput.SetFocus Exit Sub End If If (wrkOutput = "") Then MessageError "Must specify the Output Directory." txtOutput.SetFocus Exit Sub End If If (JMTestDirectory(wrkOutput) = False) Then Select Case MsgBox("Output Directory [" & wrkOutput & "] does not exist." & NL2 & "Do you want to create it?", vbDefaultButton2 + vbYesNo + vbQuestion, "VB Project Copy") Case vbYes Case Else txtOutput.SetFocus Exit Sub End Select If (JMCreateFolder(wrkOutput, wrkError) = False) Then MessageError "Can't create Output Directory [" & wrkOutput & "]." & NL2 & wrkError txtOutput.SetFocus Exit Sub End If End If wrkOutputProject = JMAddMissingBackslash(wrkOutput) & JMExtractFileName(wrkInput) If (StrComp(wrkInput, wrkOutputProject, 1) = 0) Then MessageError "Input and Output Directories are the same." txtOutput.SetFocus Exit Sub End If If (JMTestDriveWrite(wrkOutput, wrkError) = False) Then MessageError wrkError txtOutput.SetFocus Exit Sub End If If (JMTestDriveIsReady(wrkOutput) = False) Then MessageError "Output Directory [" & wrkOutput & "] is on a Drive that is Not Ready." txtOutput.SetFocus Exit Sub End If wrkPath = JMAddMissingBackslash(wrkOutput) & "*.*" wrkFile = Dir$(wrkPath) If (wrkFile <> "") Then MessageError "Output Directory [" & wrkOutput & "] contains files. Clear first." txtOutput.SetFocus Exit Sub End If If (JMTestDriveRemoveable(wrkOutput) = True) Then Select Case MsgBox("Output Directory [" & wrkOutput & "] is on a Removeable Drive." & NL2 & "Do you want to continue?", vbDefaultButton2 + vbYesNo + vbQuestion, "VB Project Copy") Case vbYes Case Else Exit Sub End Select wrkRemoveable = True End If If (JMOpenInputFile(wrkInput) = False) Then MessageError "Can't open Input VB Project [" & wrkInput & "]." txtInput.SetFocus Exit Sub End If wrkPos = JMStringLastBackslash(wrkInput) wrkInputDirectory = "" If (wrkPos > 0) Then wrkInputDirectory = Left$(wrkInput, wrkPos) NumberVBFiles = 0 fraStatus.Caption = "Checking Input Directory" Do If (EOF(1) = True) Then Exit Do Line Input #1, wrkInputData wrkPos = InStr(1, wrkInputData, "=") wrkFlag = True If (wrkPos > 0) Then Select Case LCase$(Trim$(Left$(wrkInputData, wrkPos - 1))) Case "form" wrkFlag = AddVBFile(wrkInputDirectory, Trim$(Mid$(wrkInputData, wrkPos + 1)), "Form") Case "module" wrkPos = InStr(wrkPos, wrkInputData, "; ") If (wrkPos > 0) Then wrkFlag = AddVBFile(wrkInputDirectory, Trim$(Mid$(wrkInputData, wrkPos + 2)), "Module") End If Case "class" wrkPos = InStr(wrkPos, wrkInputData, "; ") If (wrkPos > 0) Then wrkFlag = AddVBFile(wrkInputDirectory, Trim$(Mid$(wrkInputData, wrkPos + 2)), "Class") End If Case "usercontrol" wrkFlag = AddVBFile(wrkInputDirectory, Trim$(Mid$(wrkInputData, wrkPos + 1)), "UserControl") Case "helpfile" If (chkNoHelp.Value = 0) Then wrkFlag = AddVBFile(wrkInputDirectory, Trim$(Mid$(wrkInputData, wrkPos + 1)), "Help") End If Case "exename32" If (chkNoExe.Value = 0) Then wrkFlag = AddVBFile(wrkInputDirectory, Trim$(Mid$(wrkInputData, wrkPos + 1)), "EXE") End If End Select If (wrkFlag = False) Then MessageError "More than 1000 Files. Can't copy." Exit Sub End If Refresh DoEvents If (InterruptFlag = True) Then MessageInfo "Run Interrupted." txtInput.SetFocus Exit Sub End If End If Loop JMCloseFile 1 wrkFlag = False wrkString2 = "The following Files appear to be Missing." & NL For kk = 1 To NumberVBFiles If (VBFiles(kk).VFilePresent = False) Then wrkFlag = True wrkString2 = wrkString2 & NL & VBFiles(kk).VFileName End If Next kk If (wrkFlag = True) Then MessageError wrkString2 Select Case MsgBox("Do you want to Continue?", vbDefaultButton2 + vbYesNo + vbQuestion, "VB Project Copy") Case vbYes Case Else Exit Sub End Select End If fraStatus.Caption = "Copying VB Project" txtStatus.Text = "Creating " & wrkOutputProject If (JMFileCopy(wrkInput, wrkOutputProject) = False) Then MessageError "Can't copy File [" & wrkInput & "]." txtInput.SetFocus Exit Sub End If wrkFindFlag = False For kk = 1 To 4 If (txtFind(kk).Text <> "") Then wrkFindFlag = True Next kk wrkTotalSize = 0 fraStatus.Caption = "Checking File Space" Refresh For kk = 1 To NumberVBFiles VBFiles(kk).VFileLength = FileLen(VBFiles(kk).VFilePath) wrkTotalSize = wrkTotalSize + VBFiles(kk).VFileLength Next kk If (wrkRemoveable = False) Then If (wrkTotalSize >= (JMTestDriveAvailableSpace(wrkOutput) - 1024)) Then MessageError "Output Directory [" & wrkOutput & "] does not have enough space to Store All Files." txtOutput.SetFocus Exit Sub End If End If fraStatus.Caption = "Copying VB Project" Refresh For kk = 1 To NumberVBFiles If (VBFiles(kk).VFileCopy = True) Then txtStatus.Text = "Copying " & VBFiles(kk).VFileName Refresh wrkPath = JMAddMissingBackslash(wrkOutput) & VBFiles(kk).VFileName If (JMFileExists(VBFiles(kk).VFilePath) = False) Then MessageError "Can't find File [" & VBFiles(kk).VFilePath & "], which was detected on initial search." txtInput.SetFocus Exit Sub End If If (JMTestCanWrite("VB Project Copy", wrkPath, VBFiles(kk).VFileLength, wrkError) = False) Then If (wrkError <> "") Then MessageError "Can't write to Output Directory [" & wrkOutput & "]." & NL2 & wrkError End If txtOutput.SetFocus Exit Sub End If Select Case VBFiles(kk).VFileType Case "Help" If (chkNoHelp.Value = 0) Then If (JMFileCopy(VBFiles(kk).VFilePath, wrkPath) = False) Then MessageError "Can't copy Help File [" & VBFiles(kk).VFilePath & "]." txtInput.SetFocus Exit Sub End If End If Case "EXE" If (chkNoExe.Value = 0) Then If (JMFileCopy(VBFiles(kk).VFilePath, wrkPath) = False) Then MessageError "Can't copy Execute File [" & VBFiles(kk).VFilePath & "]." txtInput.SetFocus Exit Sub End If End If Case Else wrkCopyFlag = True If (wrkFindFlag = True) Then If (JMOpenInputFile(VBFiles(kk).VFilePath) = False) Then MessageError "Can't open " & VBFiles(kk).VFileType & " [" & VBFiles(kk).VFilePath & "], which was detected on initial search." txtInput.SetFocus Exit Sub End If VBFiles(kk).VFileContents = Input(VBFiles(kk).VFileLength, 1) JMCloseFile 1 wrkString = VBFiles(kk).VFileContents For kkk = 1 To 4 If (txtFind(kkk).Text <> "") Then wrkCase = 0 If (chkCase(kkk).Value = 0) Then wrkCase = 1 If (InStr(1, wrkString, txtFind(kkk).Text, wrkCase) <> 0) Then wrkString = JMStringReplace(wrkString, txtFind(kkk).Text, txtReplace(kkk).Text, wrkCase, 0) wrkCopyFlag = False End If End If Next kkk End If If (wrkCopyFlag = False) Then If (JMOpenOutputFile(wrkPath) = False) Then MessageError "Can't create " & VBFiles(kk).VFileType & " [" & wrkPath & "] in Output Directory." txtOutput.SetFocus Exit Sub End If JMOutputPrint wrkString JMCloseFile 2 Else If (JMFileCopy(VBFiles(kk).VFilePath, wrkPath) = False) Then MessageError "Can't copy " & VBFiles(kk).VFileType & " [" & VBFiles(kk).VFilePath & "]." txtInput.SetFocus Exit Sub End If End If Select Case VBFiles(kk).VFileType Case "Form" wrkInputPathX = Left$(VBFiles(kk).VFilePath, Len(VBFiles(kk).VFilePath) - 1) & "x" wrkPathX = Left$(wrkPath, Len(wrkPath) - 1) & "x" If (JMFileExists(wrkInputPathX) = True) Then If (JMFileCopy(wrkInputPathX, wrkPathX) = False) Then MessageError "Can't copy Form [" & wrkInputPathX & "]." txtInput.SetFocus Exit Sub End If End If End Select End Select Refresh DoEvents If (InterruptFlag = True) Then MessageInfo "Run Interrupted." txtInput.SetFocus Exit Sub End If End If Next kk MessageInfo "Run Successfully Completed." End Sub Function JMStringReplace(argInput As String, argFind As String, argReplace As String, argMode As Integer, argNumber As Integer) As String Dim wrkString As String Dim wrkFindLength As Long Dim wrkReplaceLength As Long Dim wrkPos As Long Dim wrkCount As Long On Error Resume Next If (StrComp(argFind, argReplace, 0) = 0) Then JMStringReplace = argInput Exit Function End If wrkString = argInput wrkFindLength = Len(argFind) wrkReplaceLength = Len(argReplace) wrkCount = 0 wrkPos = 1 Do wrkPos = InStr(wrkPos, wrkString, argFind, argMode) If (wrkPos <= 0) Then JMStringReplace = wrkString Exit Function End If wrkString = Left$(wrkString, wrkPos - 1) & argReplace & Mid$(wrkString, wrkPos + wrkFindLength) wrkPos = wrkPos + wrkReplaceLength wrkCount = wrkCount + 1 If (wrkCount = argNumber) Then JMStringReplace = wrkString Exit Function End If Loop End Function Private Sub Form_Load() Dim wrkLeft As String Dim wrkTop As String Dim kk As Integer On Error Resume Next VBCProgramName = "VBPrjCopy" NL = Chr$(13) & Chr$(10) NL2 = NL & Chr$(10) cmdInput.Height = txtInput.Height cmdInput.Width = cmdInput.Left + cmdInput.Width - txtInput.Left - txtInput.Width cmdInput.Left = txtInput.Left + txtInput.Width txtInput.Text = "" cmdOutput.Height = txtOutput.Height cmdOutput.Width = cmdOutput.Left + cmdOutput.Width - txtOutput.Left - txtOutput.Width cmdOutput.Left = txtOutput.Left + txtOutput.Width txtOutput.Text = "" txtInput.Text = GetSetting(VBCProgramName, "Startup", "InputFile", "") txtOutput.Text = GetSetting(VBCProgramName, "Startup", "OutputDirectory", "") chkNoExe.Value = 1 If (GetSetting(VBCProgramName, "Startup", "NoExe", "1") <> "1") Then chkNoExe.Value = 0 chkNoHelp.Value = 1 If (GetSetting(VBCProgramName, "Startup", "NoHelp", "1") <> "1") Then chkNoHelp.Value = 0 fraStatus.Caption = "Status" txtStatus.Text = "Enter VB Project and Output Directory" txtStatus.Locked = True For kk = 1 To 4 txtFind(kk).Text = "" txtReplace(kk).Text = "" lblWith(kk).Left = txtFind(kk).Left + txtFind(kk).Width + (txtReplace(kk).Left - txtFind(kk).Left - txtFind(kk).Width - lblWith(kk).Width) \ 2 lblWith(kk).Top = txtFind(kk).Top + (txtFind(kk).Height - lblWith(kk).Height) \ 2 chkCase(kk).Value = 0 chkCase(kk).Top = txtFind(kk).Top + (txtFind(kk).Height - chkCase(kk).Height) \ 2 Next kk wrkLeft = GetSetting(VBCProgramName, "Startup", "Left", "") If (wrkLeft = "") Then Left = (Screen.Width - Width) * 0.5 Else Left = Val(wrkLeft) End If wrkTop = GetSetting(VBCProgramName, "Startup", "Top", "") If (wrkTop = "") Then Top = (Screen.Height - Height) * 0.4 Else Top = Val(wrkTop) End If SetFormPosition Me, Top, Left End Sub Private Sub Form_Unload(Cancel As Integer) On Error Resume Next If (RunFlag = True) Then Cancel = True Exit Sub End If SaveSetting VBCProgramName, "Startup", "InputFile", txtInput.Text SaveSetting VBCProgramName, "Startup", "OutputDirectory", txtOutput.Text SaveSetting VBCProgramName, "Startup", "Left", Trim$(Str$(Left)) SaveSetting VBCProgramName, "Startup", "Top", Trim$(Str$(Top)) SaveSetting VBCProgramName, "Startup", "NoExe", Trim$(Str$(chkNoExe.Value)) SaveSetting VBCProgramName, "Startup", "NoHelp", Trim$(Str$(chkNoHelp.Value)) End Sub Public Sub MessageError(argMessage As String) On Error Resume Next MsgBox argMessage, vbCritical + vbOKOnly, "VB Project Copy Error" End Sub Public Sub MessageInfo(argMessage As String) On Error Resume Next MsgBox argMessage, vbInformation + vbOKOnly, "VB Project Copy Information" End Sub Private Sub txtFind_Change(Index As Integer) On Error Resume Next If (txtFind(Index).Text = "") Then lblWith(Index).Visible = False txtReplace(Index).Visible = False chkCase(Index).Visible = False Else lblWith(Index).Visible = True txtReplace(Index).Visible = True chkCase(Index).Visible = True End If End Sub Public Function AddVBFile(argInput As String, argFile As String, argType As String) As Integer Dim wrkFile As String AddVBFile = False On Error Resume Next If (NumberVBFiles >= 1000) Then Exit Function wrkFile = Trim$(argFile) If ((Left$(wrkFile, 1) = """") And (Right$(wrkFile, 1) = """")) Then wrkFile = Mid$(wrkFile, 2, Len(wrkFile) - 2) End If If (wrkFile = "") Then AddVBFile = True Exit Function End If NumberVBFiles = NumberVBFiles + 1 VBFiles(NumberVBFiles).VFileName = wrkFile VBFiles(NumberVBFiles).VFilePath = JMAddMissingBackslash(argInput) & wrkFile VBFiles(NumberVBFiles).VFileType = argType VBFiles(NumberVBFiles).VFilePresent = JMFileExists(VBFiles(NumberVBFiles).VFilePath) VBFiles(NumberVBFiles).VFileCopy = True If (InStr(argFile, "\") <> 0) Then VBFiles(NumberVBFiles).VFileCopy = False VBFiles(NumberVBFiles).VFileLength = 0 If (VBFiles(NumberVBFiles).VFilePresent = True) Then VBFiles(NumberVBFiles).VFileLength = FileLen(VBFiles(NumberVBFiles).VFilePath) End If txtStatus.Text = argType & " - " & wrkFile AddVBFile = True End Function Public Sub DisableForm() Dim kk As Integer On Error Resume Next cmdCancel.Caption = "Stop" cmdInput.Enabled = False txtInput.Enabled = False cmdOutput.Enabled = False txtOutput.Enabled = False fraReplace.Enabled = False For kk = 1 To 4 txtFind(kk).Enabled = False lblWith(kk).Enabled = False txtReplace(kk).Enabled = False chkCase(kk).Enabled = False Next kk cmdOpenInput.Enabled = False cmdOpenOutput.Enabled = False fraOptions.Enabled = False chkNoExe.Enabled = False chkNoHelp.Enabled = False End Sub Public Sub EnableForm() Dim kk As Integer On Error Resume Next MousePointer = 0 cmdCancel.Caption = "Exit" cmdCancel.MousePointer = 0 cmdInput.Enabled = True txtInput.Enabled = True cmdOutput.Enabled = True txtOutput.Enabled = True cmdClear.Enabled = True cmdRun.Enabled = True cmdCancel.Enabled = True fraReplace.Enabled = True For kk = 1 To 4 txtFind(kk).Enabled = True lblWith(kk).Enabled = True txtReplace(kk).Enabled = True chkCase(kk).Enabled = True Next kk cmdOpenInput.Enabled = True cmdOpenOutput.Enabled = True fraOptions.Enabled = True chkNoExe.Enabled = True chkNoHelp.Enabled = True RunFlag = False fraStatus.Caption = "Status" txtStatus.Text = "Enter VB Project and Output Directory" End Sub